package com.ruoyi.web.controller.activity;

import com.ruoyi.activity.domain.ActHistoricActivityInstanceInfo;
import com.ruoyi.activity.service.IActTaskService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Api(tags = {"流程节点接口"})
@Controller
@RequestMapping("/task/manage")
public class TaskController extends BaseController {


    @Autowired
    private IActTaskService actTaskService;

    private String prefix = "activiti/task";


    @ApiOperation("根据节点ID获取节点")
    @RequestMapping(value = "/node", method = RequestMethod.GET)
    @ResponseBody
    public AjaxResult getNodeById(@ApiParam(value = "流程节点ID")@RequestParam String taskId) {
        return AjaxResult.success(actTaskService.getNodeById(taskId));
    }

    @ApiOperation("根据流程ID获取节点(审批记录)")
    @RequestMapping(value = "/nodes", method = RequestMethod.GET)
    @ResponseBody
    public AjaxResult<List<ActHistoricActivityInstanceInfo>> getNodesByFlowId(@ApiParam(value = "流程实例ID")@RequestParam String flowId) {
        return AjaxResult.success(actTaskService.getNodesByFlowId(flowId));
    }


}
